#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
int max(int a, int b) { if (a>b) return a; else return b; }
bool ispasswd(char* s, int start, int end)
{
    if(end < start)
        return false;
    int i = start;
    int j = end;
    while(i <= j)
    {
        if (s[i] != s[j])
        {
            break;
        }
        i++;
        j--;
    }
    if (i>j)
    {
        return true;
    }
    else
    {
        return false;
    }
        
}

int longestSymatrixString(char* s, int start, int end)
{
    if(end < start)
        return 0;
    int i = 0;
    int j = 0;
    int longestlen = 0;
    bool result = false;
    for (i = start; i <= end; ++i)
    {
        for (j = i; j >= 0 ; --j)
        {
            if (ispasswd(s, j, end - i + j) == true)
            {
                longestlen = end - i + 1;
                break; 
            }
        }
        if (longestlen > 0)
        {
            break;
        }
    }
    return longestlen;
}

int main(int argc, char const *argv[])
{
    char s[65535];
    int slen = 0;
    while(scanf("%s", s) != EOF)
    {
        slen = strlen(s);
        printf("%d\n", longestSymatrixString(s, 0, slen - 1));
    }
    return 0;
}
